import router from '@/router';
import { Component, Vue } from 'vue-property-decorator';
import { HomeComponent } from '../components/HomeComponent';
import { MyStorge } from '../util/localstorge-helper';
import { userModel } from '../data/index'
@Component({
    components: {
        HomeComponent,
    }
})
export class Login extends Vue {

    private viewUser: userModel = { username: '', password: '' };
    created() {
        this.viewUser.username = '';
        this.viewUser.password = '';
    }

    onsubmit() {
        alert('登录成功');
        MyStorge.setItem('auth', this.viewUser);
        router.push({ name: 'ShowModule' })
    }

    private render() {
        return (
            <el-container>
                <el-main>
                    <el-row>
                        <el-col span={24}>
                            <p>这是登录页面</p>
                        </el-col>
                        <el-col span={24}>
                            <el-form ref="form" label-width="80px">
                                <el-form-item label="账号">
                                    <el-input v-model={this.viewUser.username}></el-input>
                                </el-form-item>
                                <el-form-item label="密码">
                                    <el-input v-model={this.viewUser.password}></el-input>
                                </el-form-item>
                                <el-form-item>
                                    <el-button type="primary" on-click={this.onsubmit}>立即创建</el-button>
                                </el-form-item>
                            </el-form>
                        </el-col>
                    </el-row>
                </el-main>
            </el-container>
        );
    }
}


export interface loginInterface {
    color?: string,
    [pname: string]: any,
}

export class login {
    static staticstring: string = 'staticparam';
    getresult() {
        return 'getresult';
    }

    private set() { }
    pset() { }
}
